package com.lbssoft.gpsbd.controller;

import com.lbssoft.gpsbd.model.Result;
import com.lbssoft.gpsbd.service.MediaService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api("多媒体信息")
@RestController
@RequestMapping("/medias")
public class MediaController {


	@Autowired
	private MediaService mediaService;

	@ApiOperation(value="获取设备的多媒体信息", notes="获取设备的多媒体信息")
	@ApiImplicitParams({
			@ApiImplicitParam(paramType="query",name = "page", value = "当前页",   dataType = "int"),
			@ApiImplicitParam(paramType="query",name = "pageSize", value = "每页显示的条数",  dataType = "int"),
			@ApiImplicitParam(paramType="query",name = "deviceId", value = "设备id",  dataType = "long")
	})
	@RequestMapping(value = "",method = {RequestMethod.GET})
	@ResponseBody
	public Result list(@NotEmpty @RequestParam(value = "page", defaultValue = "1") int page,
					   @NotEmpty @RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
					   @RequestParam(value = "deviceId", defaultValue = "") long deviceId) {
		return mediaService.getMedias(deviceId,page,pageSize);
	}

}